package com.mantou.mantouaiagent.entities;

import lombok.Builder;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;


@Data
@Builder
public class SpringSecurityUserDetails implements UserDetails
{

    private Integer uid;
    private String username;
    private String password;

    public SpringSecurityUserDetails(Integer uid, String username, String password)
    {
        this.uid = uid;
        this.username = username;
        this.password = password;
    }

    // 权限
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities()
    {
        return null;
    }

    @Override
    public String getPassword()
    {
        return null;
    }

    @Override
    public String getUsername()
    {
        return null;
    }

    // 账号是否过期
    @Override
    public boolean isAccountNonExpired()
    {
        return UserDetails.super.isAccountNonExpired();
    }
    // 账号是否锁定
    @Override
    public boolean isAccountNonLocked()
    {
        return UserDetails.super.isAccountNonLocked();
    }
    // 密码是否过期
    @Override
    public boolean isCredentialsNonExpired()
    {
        return UserDetails.super.isCredentialsNonExpired();
    }
    // 账号是否可用
    @Override
    public boolean isEnabled()
    {
        return UserDetails.super.isEnabled();
    }
}
